package cn.ucox.web.ms;

import java.util.HashMap;

/**
 * @author chenw
 * @create 2017-05-26 21:24
 * @email javacspring@gmail.com
 */
public final class Constant {

    //每个任务处理器处理数据条数
    public static final int CPU_PROCESSOR_NUMBER = Runtime.getRuntime().availableProcessors();

    public static final int ACTION_INSERT = 1;
    public static final int ACTION_UPDATE = 2;
    public static final int ACTION_DELETE = 4;
    public static final String TRIGGER_INSERT = "1";//oracle新增触发器
    public static final String TRIGGER_UPDATE = "2";//oracle更新触发器
    public static final String TRIGGER_MODIFY = "3";//postgresql更改触发器
    public static final String TRIGGER_DELETE = "4";//postgresql、oracle删除触发器
    public static final String SYNC_QUEUE_HEAD_FLAG = "##DEX_HEAD";
    public static final String SYNC_QUEUE_TAIL_FLAG = "##DEX_TAIL";
    public static final String SYNC_ANCHOR = "SYNC:ANCHOR";
    public static final String SYNC_FTP_PARSE_ANCHOR = "FTP:DATA:PARSE:ANCHOR";
    public static final String KEY_FTP_FILE_DETENTION_NUM = "detention";
    public static final byte[] SYNC_ANCHOR_BYTE = SYNC_ANCHOR.getBytes();
    public static final String SYNC_DATA = "SYNC:DATA";
    public static final byte[] SYNC_DATA_BYTE = SYNC_DATA.getBytes();
    public static final String DEXC_MONITOR = "DEXC:MONITOR";
    public static final byte[] DEXC_MONITOR_BYTE = DEXC_MONITOR.getBytes();
    public static final String SYNC_ANCHOR_TRANSACTION_ID = "tid";
    public static final String SYNC_QUEUE = "SYNC:QUEUE";
    public static final byte[] SYNC_QUEUE_BYTE = SYNC_QUEUE.getBytes();
    public static final String SYNC_QUEUE_BACKUP = "SYNC:QUEUE:BACKUP";
    public static final byte[] SYNC_QUEUE_BACKUP_BYTE = SYNC_QUEUE_BACKUP.getBytes();
    public static final String SYNC_LOG_FTP = "SYNC:LOG:FTP";
    public static final byte[] SYNC_LOG_FTP_BYTE = SYNC_LOG_FTP.getBytes();
    public static final String SYNC_MONITOR_FTP = "SYNC:MONITOR:FTP";
    public static final byte[] SYNC_MONITOR_FTP_BYTE = SYNC_MONITOR_FTP.getBytes();
    public static final byte[] SYNC_ANCHOR_TRANSACTION_ID_BYTE = SYNC_ANCHOR_TRANSACTION_ID.getBytes();
    public static final String SYNC_ANCHOR_SYNC_TASK_START_TIME = "sst";
    public static final byte[] SYNC_ANCHOR_SYNC_TASK_START_TIME_BYTE = SYNC_ANCHOR_SYNC_TASK_START_TIME.getBytes();
    public static final String SYNC_ANCHOR_SYNC_TASK_END_TIME = "set";
    public static final byte[] SYNC_ANCHOR_SYNC_TASK_END_TIME_BYTE = SYNC_ANCHOR_SYNC_TASK_END_TIME.getBytes();
    public static final String SYNC_ANCHOR_SYNC_DATA_START_TIME = "dst";
    public static final byte[] SYNC_ANCHOR_SYNC_DATA_START_TIME_BYTE = SYNC_ANCHOR_SYNC_DATA_START_TIME.getBytes();
    public static final String SYNC_ANCHOR_SYNC_DATA_END_TIME = "det";
    public static final byte[] SYNC_ANCHOR_SYNC_DATA_END_TIME_BYTE = SYNC_ANCHOR_SYNC_DATA_END_TIME.getBytes();
    public static final String SYNC_ANCHOR_TOTAL_TASK_NUM = "ttn";
    public static final byte[] SYNC_ANCHOR_TOTAL_TASK_NUM_BYTE = SYNC_ANCHOR_TOTAL_TASK_NUM.getBytes();
    public static final String SYNC_ANCHOR_TASK_DONE_NUM = "tdn";
    public static final byte[] SYNC_ANCHOR_TASK_DONE_NUM_BYTE = SYNC_ANCHOR_TASK_DONE_NUM.getBytes();
    public static final String SYNC_ANCHOR_TRANSACTION_DATA_ROWS = "tdr";
    public static final byte[] SYNC_ANCHOR_TRANSACTION_DATA_ROWS_BYTE = SYNC_ANCHOR_TRANSACTION_DATA_ROWS.getBytes();
    public static final String SYNC_ANCHOR_TRANSACTION_DATA_SIZE = "tds";
    public static final byte[] SYNC_ANCHOR_TRANSACTION_DATA_SIZE_BYTE = SYNC_ANCHOR_TRANSACTION_DATA_SIZE.getBytes();
    public static final String SYNC_ANCHOR_TRANSACTION_DONE = "ttd";
    public static final byte[] SYNC_ANCHOR_TRANSACTION_DONE_BYTE = SYNC_ANCHOR_TRANSACTION_DONE.getBytes();

    public static final String SYNC_MSST = "msst";
    public static final String SYNC_MSET = "mset";
    public static final String SYNC_MDST = "mdst";
    public static final String SYNC_MDET = "mdet";
    public static final byte[] SYNC_MSST_BYTE = SYNC_MSST.getBytes();
    public static final byte[] SYNC_MSET_BYTE = SYNC_MSET.getBytes();
    public static final byte[] SYNC_MDST_BYTE = SYNC_MDST.getBytes();
    public static final byte[] SYNC_MDET_BYTE = SYNC_MDET.getBytes();

    public static final String SYNC_LSST = "lsst";
    public static final String SYNC_LSET = "lset";
    public static final String SYNC_LDST = "ldst";
    public static final String SYNC_LDET = "ldet";
    public static final byte[] SYNC_LSST_BYTE = SYNC_LSST.getBytes();
    public static final byte[] SYNC_LSET_BYTE = SYNC_LSET.getBytes();
    public static final byte[] SYNC_LDST_BYTE = SYNC_LDST.getBytes();
    public static final byte[] SYNC_LDET_BYTE = SYNC_LDET.getBytes();

    public static final String SYNC_LEVEL_HIGH = "H";
    public static final String SYNC_LEVEL_MEDIUM = "M";
    public static final String SYNC_LEVEL_LOW = "L";

    public static final HashMap<String, String> SYNC_LEVEL_MAP = new HashMap<String, String>() {
        {
            put(SYNC_LEVEL_HIGH, "#高#");
            put(SYNC_LEVEL_MEDIUM, "#中#");
            put(SYNC_LEVEL_LOW, "#低#");
        }
    };

    public static final String LOG_PARSE = "LOG:PARSE";
    public static final String SYNC_TRANS_RESULT_DATA = "SYNC:TRANS:RESULT:DATA";
    public static final String SYNC_TRANS_RESULT_DATA_BACKUP = "SYNC:TRANS:RESULT:DATA:BACKUP";
}
